package com.fufu.leetcode;

import java.util.Scanner;

/**
 * @author: BlcakTiger
 * @date: 2023/2/25 20:53
 * @contact: hsf6661@163.com
 */
public class 卡片 {

    public static void main(String[] args) {
        int[] cardPool = new int[10];
        for (int i = 0; i < cardPool.length; i++) {
           cardPool[i] = 2021;
        }

        int num = 0;
        boolean flag = false;
        while (true){
            num++;
            char[] numStr = ("" + num).toCharArray();
            for (char c:numStr){
                if (cardPool[c-'0']==0){
                    flag = true;
                    num--;
                    break;
                }
                cardPool[c-'0']--;
            }
            if (flag){
                break;
            }
        }
        System.out.println(num);
    }




}
